Skip to content

Conversation

@khos2ow
Copy link
Contributor

@khos2ow khos2ow commented Jul 16, 2020

This PR adds SetEscapeHTML function with the same signature and functionality of json package in standard lib to control whether escapes problematic HTML character or not.

Example usage:

func main() {
    o := orderedmap.New()
    o.SetEscapeHTML(false)
    o.Set("string", "\\.<>[]{}_-")

    b, err := json.Marshal(o)
    if err != nil {
        return []byte{}, err
    }
    fmt.Println(string(b))

    // Output:
    // {"string":"\\.<>[]{}_-"}
}

@khos2ow
Copy link
Contributor Author

khos2ow commented Oct 15, 2020

@iancoleman can you please take a look at this?

@iancoleman iancoleman merged commit a07d3b8 into iancoleman:master Oct 16, 2020
@iancoleman
Copy link
Owner

Thanks for this. I added a v0.1.0 tag as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants